ICollection.CopyTo Method

Task Parallel System.Threading

Copies all of the items in the BlockingCollection<(Of <(T>)>) instance to a compatible one-dimensional array, starting at the specified index of the target array.

Namespace:  System.Collections.Concurrent
Assembly:  System.Threading (in System.Threading.dll)

Syntax

Visual Basic (Declaration)
Private Sub CopyTo ( _
	array As Array, _
	index As Integer _
) Implements ICollection.CopyTo
C#
void ICollection.CopyTo(
	Array array,
	int index
)

Parameters

array
Type: System..::.Array
The one-dimensional array that is the destination of the elements copied from the BlockingCollection<(Of <(T>)>) instance. The array must have zero-based indexing.
index
Type: System..::.Int32
The zero-based index in array at which copying begins.

Implements

ICollection..::.CopyTo(Array, Int32)

Exceptions

ExceptionCondition
System..::.ArgumentNullExceptionThe array argument is null.
System..::.ArgumentOutOfRangeExceptionThe index argument is less than zero.
System..::.ArgumentExceptionThe index argument is equal to or greater than the length of the array, the array is multidimensional, or the type parameter for the collection cannot be cast automatically to the type of the destination array.
System..::.ObjectDisposedExceptionThe BlockingCollection<(Of <(T>)>) has been disposed.

See Also